import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import 'world_item_widget.dart';
import 'world_list_logic.dart';

/// @description:
/// @author
/// @date: 2024-09-23 11:37:38
class WorldListPage extends StatefulWidget {
  const WorldListPage({Key? key, required this.categoryId}) : super(key: key);
  final int categoryId;

  @override
  State<WorldListPage> createState() => _WorldListPageState();
}

class _WorldListPageState extends State<WorldListPage> {
  late WorldListLogic logic;

  @override
  void initState() {
    logic = Get.put(WorldListLogic(categoryId: widget.categoryId), tag: widget.categoryId.toString());
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<WorldListLogic>(
        init: WorldListLogic(categoryId: widget.categoryId),
        tag: widget.categoryId.toString(),
        initState: (_) {
          // logic.getCommentList(callBack: () {
          //   setState(() {});
          // });
        },
        builder: (context) {
          return Scaffold(
            backgroundColor: const Color(0xFFF5FAF9),
            body: ListView.separated(
              padding: EdgeInsets.only(top: 8.h),
              scrollDirection: Axis.vertical,
              shrinkWrap: true,
              itemCount: 10,
              itemBuilder: (BuildContext context, int index) {
                return WorldItemWidget(index: index);
              },
              separatorBuilder: (context, index) => Container(
                height: 10,
                color: const Color(0xFFF5FAF9).withOpacity(1),
              ),
            ),
            // body: PullRefreshWidget(
            //   isDeep: true,
            //   controller: logic.refreshController,
            //   onRefresh: () async {},
            //   onLoading: () async {},
            //   pageStatus: logic.pageStatus,
            //   data: const ['1'],
            //   child: ListView.separated(
            //     padding: EdgeInsets.only(top: 8.h),
            //     scrollDirection: Axis.vertical,
            //     shrinkWrap: true,
            //     itemCount: 9,
            //     itemBuilder: (BuildContext context, int index) {
            //       return WorldItemWidget(index: index);
            //     },
            //     separatorBuilder: (context, index) => Container(
            //       height: 10,
            //       color: const Color(0xFFF5FAF9).withOpacity(1),
            //     ),
            //   ),
            // ),
          );
        });
  }
}
